/*
 * MIT License
 *
 * Copyright (c) 2025 Mark·虎
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 *
 */

package com.hsxxherp.key.support.model.dto;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;

import java.time.OffsetDateTime;

/**
 * 基础DTO实体
 *
 * @author Mark·虎克（2486970363@qq.com）
 * @version 1.0
 * @since 2025-2-23
 */
@Schema(name = "BaseAuditEntity", description = "基础审计信息实体类，包含创建人、创建时间、修改人、修改时间和软删除标识")
public class BaseDto {

    @TableId(type = IdType.ASSIGN_ID)
    @Schema(description = "实体的唯一标识", example = "1234567890123456789")
    private String id;

    /**
     * 创建人
     */
    @TableField(value = "created_by", fill = FieldFill.INSERT)
    @Schema(name = "created_by", description = "创建该实体的人员主键", example = "1234567890123456789")
    private String createdBy;

    /**
     * 创建时间，使用 OffsetDateTime 以支持多时区
     */
    @TableField(value = "created_time", fill = FieldFill.INSERT)
    @Schema(name = "created_time", description = "实体的创建时间，使用 OffsetDateTime 类型以支持多时区", example = "2024-10-01T12:00:00+08:00")
    private OffsetDateTime createdTime;

    /**
     * 修改人
     */
    @TableField(value = "updated_by", fill = FieldFill.INSERT_UPDATE)
    @Schema(name = "updated_by", description = "最后修改该实体的人员主键", example = "1234567890123456789")
    private String updatedBy;

    /**
     * 修改时间，使用 OffsetDateTime 以支持多时区
     */
    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
    @Schema(name = "updated_time", description = "实体的最后修改时间，使用 OffsetDateTime 类型以支持多时区", example = "2024-10-02T14:30:00+08:00")
    private OffsetDateTime updatedTime;

    /**
     * 软删除标识，true 表示已删除，false 表示未删除
     */
    @TableLogic
    @TableField("deleted")
    @Schema(name = "deleted", description = "软删除标识，true 表示该实体已被删除，false 表示未删除", example = "false")
    private Boolean deleted;

    /**
     * 乐观锁版本号
     */
    @Version
    @Schema(description = "乐观锁版本号，用于并发控制", example = "1")
    private Integer version;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    public OffsetDateTime getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(OffsetDateTime createdTime) {
        this.createdTime = createdTime;
    }

    public String getUpdatedBy() {
        return updatedBy;
    }

    public void setUpdatedBy(String updatedBy) {
        this.updatedBy = updatedBy;
    }

    public OffsetDateTime getUpdatedTime() {
        return updatedTime;
    }

    public void setUpdatedTime(OffsetDateTime updatedTime) {
        this.updatedTime = updatedTime;
    }

    public Boolean getDeleted() {
        return deleted;
    }

    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }
}